/*
Automatic clinic tests using a robot arm.
Copyright (C) 2010  CIC-CPC, CHU Gabriel Montpied
All other trademarks, logos and copyrights are the property
of their respective owners.

This file is part of cpc-painbot.

cpc-painbot is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

cpc-painbot is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with cpc-painbot.  If not, see <http://www.gnu.org/licenses/>.
*/
#include "stimulation/stimulateur.h"
#include "stimulation/vonfrey.h"
#include "stimulation/stimulateurpourtests.h"

#include "zone.h"

QString Stimulateur::typeToString(Type type)
{
    QString chaine;

    switch (type) {
        case VonFrey:   chaine = tr("Von Frey");    break;
        case Allodynie: chaine = tr("Allodynie");   break;
        case PourTests: chaine = tr("Pour Tests");  break;

        default: break;
    }

    return chaine;
}

Stimulateur *Stimulateur::creer(Type type, QObject *parent)
{
    Stimulateur *stimulateur = 0;

    switch (type) {
        case VonFrey: stimulateur = new ::VonFrey(parent); break;
        case Allodynie: qCritical("Stimulateur : Allodynie pas encore implementee."); break;
        case PourTests: stimulateur = new StimulateurPourTests(parent); break;

        default: qCritical("Stimulateur, creer : le type specifie n'existe pas."); break;
    }

    return stimulateur;
}

Stimulateur::Stimulateur(Type type, QObject *parent) :
    QStateMachine(parent),
    type_(type),
    zone_(new Zone(this)),
    outil_(0),
    duree_(new QTimer(this))
{
    duree_->setSingleShot(true);
    zone()->setCentre(QPointF(0, 400));
}
